import { request } from '@inbiz/utils';
// const Mock = require('/Users/zhujiaqing/.nvm/versions/node/v14.15.3/lib/node_modules/mockjs');
// import InbizConfig from 'InbizConfig';

const version = InbizConfig.API_VERSION;

export async function getImgCate(params: Banner.ImgCateParams) {
  return request(
    `/inbiz/api/services/cms/v${version}/cms/cmsCategoryList`,
    {
      params: {
        pageIndex: 1,
        categoryType: 0,
        ...params,
      },
    },
  );
}

export async function getImgList(params: Banner.ListParams) {
  return request(
    `/inbiz/api/services/cms/v${version}/cms/contentList`,
    {
      params: {
        ...params,
        version: version,
        contentType: 0,
      },
    },
  );
  // return new Promise((resolve) => {
  //   resolve(Mock.mock({
  //     'ContentList|3': [{
  //       'ID|1-20': 0,
  //       'CreateTimeStr': '2022-05-16',
  //       'Title|2-10': 'test',
  //       'Summary|1-10': 'test',
  //       'Content|1-10': 'test',
  //       'ContentUrl': '',
  //       'ImgUrl': Mock.Random.image('100x100'),
  //       'CustomCategories': '',
  //       'Tag': '',
  //       'ContentType': 1,
  //       'ContentCategory': '',
  //       'ContentCategoryName': '',
  //       'IsTop': true,
  //       'IsNew': true,
  //       'IsOutsiteUrl': '',
  //       CreateTime: '2022-05-16',
  //       LastModifiedTime: '2022-05-16',
  //       'Creator|2-3': '字',
  //       CreatorID: '',
  //       LastModifier: 'test',
  //       LastModifierID: '2022-05-16',
  //     }]
  //   }));
  // })
}

export async function getDetail(params: Banner.DetailParams) {
  return request(
    `/inbiz/api/services/cms/v${version}/cms/${params.id}/detailContentInfo`,
    {
      params,
    },
  );
}
